using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using ContactList.Web.Model;


namespace ContactList.Web.Services
{
    // NOTE: If you change the class name "ContactServices" here, you must also update the reference to "ContactServices" in Web.config.
    public class ContactServices : IContactServices
    {

        #region IContactServices Members

        public IList<Contact> GetAllContacts()
        {
            ContactDataClassesDataContext db = new ContactDataClassesDataContext();
            var matchingContacts = from c in db.Contacts
                                   select c;
            return matchingContacts.ToList();
        }

        public IList<Contact> GetContactByLastName(string lastName)
        {
            ContactDataClassesDataContext db = new ContactDataClassesDataContext();
            var matchingContacts = from c in db.Contacts
                                   where c.LastName.Contains(lastName)
                                   select c;
            return matchingContacts.ToList();
        }

        #endregion
    }
}
